
package artistic;

import java.awt.Image;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.JOptionPane;

/**
 *
 * @author Mikael Andersson
 * @author Rurik Högfeldt
 */

public class ImageLoader {
    public static void load(File file, PaintWindow window)
    {
        Image image = null;
        try{
            image = ImageIO.read(file);
            window.loadImage(image);
        }
        catch(IOException e){
            StringBuilder sb = new StringBuilder();
            sb.append("Could not load ");
            sb.append(file.getAbsolutePath());
            sb.append('\n');
            sb.append(e);
            JOptionPane.showConfirmDialog(null,
                    sb, "File loading error",
                    JOptionPane.DEFAULT_OPTION);

            return;
        }

        
    }
}
